﻿ 

@using MvcApplication4.Models;
@model IEnumerable<Student>
@{
    ViewBag.Title = "Exporting";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Grid Export</h2>
<br /><br />

<div class="sample-panel-margin" style="width: 95%;">
    @(Html.Syncfusion().Grid<Student>("GenericListGrid")
            .Datasource(Model)
    .Caption("Student Details")
    .EnablePaging()
    .EnableSorting()
    .ShowCaption(true)
    .Column(cols =>
    {
        cols.Add(c => c.UniversityCode).HeaderText("University Code").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(110);
        cols.Add(c => c.Title).HeaderText("Title");
        cols.Add(c => c.Duration).HeaderText("Duration").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(80);
        cols.Add(c => c.CourseFees).HeaderText("Course Fees").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Format("{0:C}").Width(90);
        cols.Add(c => c.CGPA).HeaderText("CGPA").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(80).Format("{0:P}");
    })
    .ToolBar(toolbar =>
    {
        toolbar.Add(GridToolBarItems.ExcelExport, "Excel").Add(GridToolBarItems.WordExport, "Word").Add(GridToolBarItems.PDFExport, "PDF");
    })

    .Mappers(map =>
    {
        map.ExportExcelAction("ExportToExcel").ExportWordAction("ExportToWord").ExportPdfAction("ExportToPDF");
    }))
</div>
